/*
*
==============================================================================
*  Name        : 
*  Part of     : Omen Game Engine
*  Description : 
*  Version     : 1.0
*
*  Copyright (c) 2013 Lauri Kortevaara.
* 
==============================================================================
*/

#define OMEN_SOURCE 1

#include "OmenGraphicsServer.h"

using namespace Omen;

/// <summary>Releases the resources of the graphics server</summary>
GraphicsServer::~GraphicsServer()
{
    for( GraphicsDriverVector::const_iterator it = graphicsDrivers.begin();
         it != graphicsDrivers.end();  ++it ) 
    {
        delete *it;
    }
}

/// <summary>Allows plugins to add new graphics drivers</summary>
/// <param name="IGraphicsDriver">Graphics driver that will be added</param>
void GraphicsServer::addGraphicsDriver( Omen::IGraphicsDriver* pIGraphicsDriver) 
{
    graphicsDrivers.push_back(pIGraphicsDriver);
}

/// <summary>Gets the total number of registered graphics drivers</summary>
size_t GraphicsServer::getDriverCount() const 
{
    return graphicsDrivers.size();
}

/// <summary>Accesses a driver by its index</summary>
IGraphicsDriver& GraphicsServer::getDriver(size_t index) 
{
    return *graphicsDrivers.at( index );
}